package com.cy.study.controller;

import com.cy.study.common.Response;
import com.cy.study.req.AdminLoginReq;
import com.cy.study.service.AdminInfoService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * 管理员控制器
 */
@RequiredArgsConstructor
@RequestMapping("/admin")
@RestController
@CrossOrigin
@Slf4j
public class AdminController {

    private final AdminInfoService adminInfoService;

    /**
     * 管理员登录
     * @param req
     * @return
     */
    @PostMapping("/login")
    public Response<String> adminLogin(@RequestBody AdminLoginReq req){
        String token = adminInfoService.adminLogin(req);
        return Response.success(token);
    }

}
